
		<!-- END LEFT SIDEBAR -->
		<!-- MAIN -->
		<style type="text/css">
		ul,ol,li{
			list-style-type: none;
		}
		.ul{
			float: right;
		}

		.ul li{
			float: left;
			width: 50px;
			height: 30px;
			border: 1px solid #000;
			line-height: 30px; 
			margin-left: 12px;
			text-align: center;
		}
		.li{
			background: red;
		}

		li a{
			display: block;
		}
		.bttn{
			width: 30px;
			height: 25px;
			line-height: 12px;
			text-align:center;

		}

		
		</style>
	 
			<!-- MAIN CONTENT -->
			<div class="main-content">
				<div class="container-fluid">
					<h3 class="page-title">分类列表</h3>
					<div class="row">
						<div class="col-md-12">
							<!-- BASIC TABLE -->
							<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title">Basic Table</h3>
								</div>
								<div class="panel-body">
									<table class="table"  action="" method="post" >
										<thead>
											<tr>
												<th>id</th>
												<th>标题</th>
												<th>类型</th>
												<!-- <th>新闻图片</th>
												<th>新闻作者</th>
												<th>新闻内容</th> -->
												<th>操作</th>
											</tr>
										</thead>
										<tbody class="tbody">
											<?php foreach ($data as $k) { ?>
											<tr pid="<?php echo $k['pid']?>" level="1">

												<td filed="id" class="db_edit"><?php echo $k['id'] ?></td>


												

												<td filed="title" class="db_edit"><button class="bttn btn-success" type="btn" value="<?php echo $k['id'] ?>">+</button><?php echo $k['news'] ?></td>

												<td filed="type" class="db_edit"  ><?php echo $k['pid'] ?></td>
												
									<td><a href="index.php?c=cate&a=edit&admin=1&id=<?php echo $k['id']?>" class="btn btn-success" type="button">编辑</a>

											<a href="index.php?c=cate&a=die&admin=1&id=<?php echo $k['id']?>"  class="btn btn-danger end"  type="button">删除</a></td>

														
											</tr>
										
									<?php } ?>
									</tbody>
									</table>
										<form >
										<ul class="ul">
										
										<!-- 	<?php echo $pages;?> -->
											
										</ul>
										</form>
										<button type="file" class="btn btn-primary btn-lg btn-block">上传</button>
								</div>
								</div>
							</div>
							<!-- END BASIC TABLE -->
						</div>
						 
				</div>
			</div>
			<!-- END MAIN CONTENT -->

			<script src="resources/admin/assets/vendor/jquery/jquery.min.js"></script>


			<script type="text/javascript">

			$(function(){

				$('.end').click(function(){

					if(!confirm('你要干嘛?')){
						return false;
					}
					
					var url = $(this).attr('href');

					$.ajax({
						type:'get',
						url:url,
						dataType:'json',
						success:function(json){
							if (json>0) {
								if (confirm('还有自己')) {
									location.href=url;
								}
							}else{
								location.href=url;
							}
						}

					})
					return false;
				})
			})


			$(function(){

				$('table').on('click','.bttn',function(){
					
					var obj=$(this).parent().parent();

					var level=parseInt(obj.attr('level'));
						level++;

					var left=level*30;

						

					var id=$(this).attr('value');

					var txt=$(this).text();
					
				if ('+'==txt) {
						txt='-';


					$.ajax({
						type:'get',
						url:'index.php?c=cate&a=news&admin=1&id='+id,
						dataType:'json',
						success:function(json){
							var html='';


							 
							for(i in json){
									html+='<tr pid="'+id+'" level="'+level+'">';
								html+='<td filed="id" class="db_edit">'+json[i].id+'</td>';

								html+='<td filed="title" class="db_edit"><button class="bttn btn-success" style="margin-left:'+left+'px";" type="btn" value="'+json[i].id+'">+</button>'+json[i].news+'</td>';

								html+='<td filed="type" class="db_edit">'+json[i].pid+'</td>';
								
								html+='<td><a href="index.php?c=cate&a=edit&admin=1&id='+json[i].id+'" class="btn btn-success" type="button">编辑</a><a href="index.php?c=cate&a=die&admin=1&id='+json[i].id+'"  class="btn btn-danger end"  type="button">删除</a></td>';
								html+='</tr><input type="hidden" pid="'+id+'">';		
							}
							 
							obj.after(html);

						}
						/*return false;*/

					})

				}else{
						txt='+';
						var pid=obj.attr('pid');
						
						/*	obj.nextUntil('tr[pid=0]').remove();*/
						
						
							obj.nextUntil('[pid='+pid+']').remove();
						
					}

					$(this).text(txt);
			})	


		})


			</script>

